
;;设置窗口位置为屏库左上角(0,0)
(set-frame-position (selected-frame) 0 0)
;;设置宽和高,我的十寸小本是140,28,大家可以调整这个参数来适应自己屏幕大小
(set-frame-width (selected-frame) 140)
(set-frame-height (selected-frame) 28)
;;恢复文件

(global-auto-revert-mode 1)
(add-to-list 'load-path "~/.emacs.d/lisp/")
(add-to-list 'load-path "~/.emacs.d/elpa/")
(require 'subdirs)
;; Package Management
;; -----------------------------------------------------------------
(require 'popup)
;;自动补全
(require 'auto-complete)
(add-to-list 'load-path "~/.emacs.d/autocomplete/")
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/autocomplete/ac-dict")
(ac-config-default)
(set-default 'ac-sources
             '(ac-source-abbrev
               ac-source-dictionary
               ac-source-yasnippet
               ac-source-words-in-buffer
               ac-source-words-in-same-mode-buffers
               ac-source-semantic))

(ac-config-default)

(dolist (m '(c-mode c++-mode java-mode))
  (add-to-list 'ac-modes m))

(global-auto-complete-mode t)
;;yas 自动

(require 'yasnippet) ;; not yasnippet-bundle
(yas/initialize)
(setq yas/root-directory "~/.emacs.d/snippets/") 
(yas/load-directory yas/root-directory)
(yas-global-mode 1)
;;自动格式化代码
(dolist (command '(yank yank-pop))
  (eval
   `(defadvice ,command (after indent-region activate)
      (and (not current-prefix-arg)
           (member major-mode
                   '(emacs-lisp-mode
                     lisp-mode
                     clojure-mode
                     scheme-mode
                     haskell-mode
                     ruby-mode
                     rspec-mode
                     python-mode
                     c-mode
                     c++-mode
                     objc-mode
                     latex-mode
                     js-mode
                     plain-tex-mode))
           (let ((mark-even-if-inactive transient-mark-mode))
             (indent-region (region-beginning) (region-end) nil))))))


;;主题

; (require 'color-theme-blackboard)
; (eval-after-load "color-theme"
;   '(progn
;      (color-theme-initialize)
;      (color-theme-blackboard)))
; (autoload 'gmail2bbdb-import-file "gmail2bbdb" nil t nil)

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(column-number-mode t)
 '(display-time-mode t)
 '(package-selected-packages
   (quote
    (gmail2bbdb register-list xterm-color web-mode todotxt-mode swiper-helm sublime-themes ssh spinner smartparens smart-mode-line sexy-monochrome-theme seti-theme session select-themes redis react-snippets python-mode password-store password-generator org-gnome org-ac occur-x nodejs-repl node-resolver monokai-theme monochrome-theme mocha mark-tools macrostep js3-mode js2-refactor jq-mode jazz-theme imenu+ iedit hungry-delete html5-schema html-script-src html-check-frag helm-ag git-commit git flycheck-color-mode-line expand-region exec-path-from-shell counsel company-auctex company-anaconda color-theme-modern coffee-fof chinese-pyim chicken-scheme chess auto-yasnippet auto-compile angular-mode ace-pinyin ac-js2)))
 '(send-mail-function (quote smtpmail-send-it))
 '(show-paren-mode t)
 '(tool-bar-mode nil))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(default ((t (:family "Microsoft YaHei UI" :foundry "outline" :slant normal :weight normal :height 150 :width normal)))))

;; copy region or whole line
(global-set-key "\M-w"
		
(lambda ()
  (interactive)
  (if mark-active
      (kill-ring-save (region-beginning)
		      (region-end))
    (progn
      (kill-ring-save (line-beginning-position)
		      (line-end-position))
      (message "copied line")))))


;; kill region or whole line
(global-set-key "\C-w"
		(lambda ()
		  (interactive)
		  (if mark-active
		      (kill-region (region-beginning)
				   (region-end))
		    (progn
		      (kill-region (line-beginning-position)
				   (line-end-position))
		      (message "killed line")))))

;; sort of fullscreen
(add-to-list 'default-frame-alist '(left . 0))
(add-to-list 'default-frame-alist '(top . 0))
(add-to-list 'default-frame-alist '(height .40))
(add-to-list 'default-frame-alist '(width . 140))
(setq server-auth-dir "C:/Users/44228/AppData/Roaming/")
(setq server-name "emacs-server-file")
;;(server-start)
 
;;自己的设置

(provide 'mysettings)

